package com.one.oa.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.one.oa.api.service.ApiLogService;
import com.one.oa.dao.ApiLogDao;
import com.one.oa.entity.ApiLog;
import com.one.oa.vo.R;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class ApiLogServiceImpl implements ApiLogService {
    @Resource
    private ApiLogDao dao;

    @Override
    public int save(String ip,String name) {
        return dao.insert(new ApiLog(ip,name));
    }

    @Override
    public R queryPage(int page, int size) {
        return R.ok(dao.selectPage(new Page<>(page,size),new QueryWrapper<ApiLog>().orderByDesc("create_time")));
    }
}
